public class test {
    public static void main(String[] args) {
        /*int a = 10;
        int b = 20;
        System.out.println("a + b 的和是：" + Sum(a,b));
    }
    public static int Sum(int a, int b) {
        return a + b;
    }
    public static double Sum(double a, double b) {
        return a + b;
    }*/
        int n = 3;
        char a = 'A';
        char b = 'B';
        char c = 'C';
        HangNuoTa(n,a,b,c);

    }
    //递归求解汉诺塔问题
    public static void HangNuoTa(int n,char a, char b, char c) {
        if( n == 1) {
            System.out.println("Move disk " + n + " from " + a + " to " + c);
            return;
        }
        HangNuoTa(n-1, a, c, b);
        System.out.println("Move disk " + n + " from " + a + " to " + c);
        HangNuoTa(n-1, c, b, a);
    }
}
